﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rabbit.Repository
{
    public class RabbitRepository<T> where T : class
    {

        RabbitDbContext _db;
        public RabbitRepository(RabbitDbContext db)
        {
            _db = db;
        }

        public List<T> GetAll()
        {
            return _db.Set<T>().ToList();
        }

        public int Add(T enity)
        {
            _db.Set<T>().Add(enity);
            return _db.SaveChanges();
        }
        public int Update(List<T> enity)
        {
            _db.Set<T>().UpdateRange(enity);
            return _db.SaveChanges();
        }
        public int Updates(T enity)
        {
            _db.Set<T>().Update(enity);
            return _db.SaveChanges();
        }


    }
}
